/**
 * Created by Administrator on 2016/5/14.
 */
function getAuth(id){
    $.ajax({
        url:"/wx/getAuth?ran="+Math.random(),
        type:"post",
        data:{
            recommendId:id
        },
        success:function(data){
            if(data.success){
                window.location.href = data.data;
            }
        },
        error:function(){}
    });
}


function loadProvince(){
    $.ajax({
        url:"/member/loadCityByLevel",
        type:"post",
        data:{
            level:"1"
        },
        success:function(res){
            var html = "<option value=''>请选择</option>";
            $.each(res,function(i,n){
                html += "<option value='"+ n.value+"'>"+ n.text+"</option>";
            });
            $("#province").html(html);
        },
        error:function(){}
    })
}

function loadCityByPNo(index){
    var id = "", name = "";
    if(index==1){
         id = $("#province").val();
         name = $("#province").find("option:selected").text();
        $("#provinceNo").val(id);
        $("#provinceName").val(name);

    }else if(index==2){
        id = $("#city").val();
        name = $("#city").find("option:selected").text();

        $("#cityNo").val(id);
        $("#cityName").val(name);
    }

    $.ajax({
       url:"/member/loadCityByPNo?r="+Math.random(),
        type:"post",
        data:{
            no:id
        },
        success:function(res){
            var html = "<option value=''>请选择</option>";
            $.each(res,function(i,n){
                html += "<option value='"+ n.value+"'>"+ n.text+"</option>";
            });
            if(index==1){
                $("#city").html(html);
            }else if(index==2){
                $("#area").html(html);
            }
        }
    });
}

function getSelectedData(){
    var  id = $("#city").val();
    var name = $("#city").find("option:selected").text();

    $("#areaNo").val(id);
    $("#areaName").val(name);
}

